package org.zhadoop.stream.cql.semanticanalyzer.parser.context;

import java.util.List;

import org.zhadoop.stream.cql.exception.SemanticAnalyzerException;
import org.zhadoop.stream.cql.semanticanalyzer.analyzecontext.expressiondesc.ExpressionDescribe;
import org.zhadoop.stream.cql.semanticanalyzer.parsecontextreplacer.ParseContextReplacer;
import org.zhadoop.stream.cql.semanticanalyzer.parsecontextwalker.ParseContextWalker;

import com.google.common.collect.Lists;

/**
 * 位操作表达式语法解析的内容
 * 
 * @author zwd
 *
 */
public class BitExpressionContext extends BaseExpressionParseContext {

	private List<String> bitOperator;

	// ArithmeticPlusMinusExpressionContext
	private List<BaseExpressionParseContext> arithmeticExpressions;

	public BitExpressionContext() {
		bitOperator = Lists.newArrayList();
		arithmeticExpressions = Lists.newArrayList();
	}

	@Override
	public void walkChildAndReplace(ParseContextReplacer replacer) {
		// TODO Auto-generated method stub

	}

	@Override
	protected ExpressionDescribe createExpressionDesc() throws SemanticAnalyzerException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append(arithmeticExpressions.get(0));
		for (int i = 0; i < bitOperator.size(); i++) {
			sb.append(" " + bitOperator.get(i) + " ").append(arithmeticExpressions.get(i + 1));
		}
		return sb.toString();
	}

	@Override
	protected void walkChild(ParseContextWalker walker) {
		// TODO Auto-generated method stub

	}

	public List<String> getBitOperator() {
		return bitOperator;
	}

	public void setBitOperator(List<String> bitOperator) {
		this.bitOperator = bitOperator;
	}

	public List<BaseExpressionParseContext> getArithmeticExpressions() {
		return arithmeticExpressions;
	}

	public void setArithmeticExpressions(List<BaseExpressionParseContext> arithmeticExpressions) {
		this.arithmeticExpressions = arithmeticExpressions;
	}
	
	

}
